package com.dgut.app.controller;

import com.dgut.app.service.NoticeService;
import com.dgut.common.utils.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author zyq
 * @Date 2022/4/10 18:57
 * @Description TODO
 * @Version 1.0
 **/
@RestController
@RequestMapping("/api/app/notice")
public class NoticeController {
    private final NoticeService noticeService;
    public NoticeController(NoticeService noticeService) {
        this.noticeService = noticeService;
    }

    /**
     * 公告列表
     */
    @GetMapping
    public R listNotice() {
        return R.ok().data(noticeService.listNotice());
    }

    /**
     * 公告列表
     */
    @GetMapping("/detail/{id}")
    public R listNotice(@PathVariable("id") Integer id) {
        return R.ok().data(noticeService.detail(id));
    }

}
